<template>
	<view class="content">
		<view class="container">
			<!--学校地图-->
			<view class="gzist-map">
				<u-swiper :list="swiperList" keyName="image" showTitle circular imgMode="scaleToFill" height=220
					@click="previewImage()"></u-swiper>
			</view>
			<!--服务菜单-->
			<view class="menu-list">
				<view class="list-item" v-for="(item,index) in list" :key="index" @click="linkPage(item.src)">
					<view class="item-icon">
						<i class="t-icon" :class="item.icon"></i>
					</view>
					<view class="item-text u-line-1">{{item.name}}</view>
				</view>
			</view>
		</view>
		<!--登录验证弹窗-->
		<login-popup v-if="modalShow"></login-popup>
	</view>
</template>

<script>
	import {
		mapState,
		mapActions
	} from 'vuex'
	export default {
		data() {
			return {
				list: [{
						name: '成绩查询',
						icon: 't-icon-chengjichaxun',
						src: '/page_service/pages/query-results'
					},
					{
						name: '出行方式',
						icon: 't-icon-jiaotongchuhang',
						src: '/page_service/pages/static_pages/travel-mode'
					},
					{
						name: '查重降重',
						icon: 't-icon-dabianzhizheng',
						src: '/page_service/pages/static_pages/weight-loss'
					},
					{
						name: '资源精选',
						icon: 't-icon--lottery',
						src: ''
					},
					{
						name: '项目沙盒',
						icon: 't-icon--tic-tac-toe',
						src: ''
					},
					{
						name: '了解社保',
						icon: 't-icon--bulb',
						src: '/page_service/pages/static_pages/social-security'
					},
					{
						name: '广理智能',
						icon: 't-icon--network-',
						src: '/page_service/pages/ai-smart'
					}
				],
				swiperList: [{
						image: 'https://yj.xiesinder.cn/prophet/service/gzist.jpg',
						title: '广州校区地图➡'
					},
					{
						image: 'https://yj.xiesinder.cn/prophet/service/gzist_hz.jpg',
						title: '惠州校区地图➡'
					}
				]
			}
		},
		onShow() {

		},
		onLoad() {

		},
		// 计算属性
		computed: {
			...mapState('user', ['modalShow', 'loginState', 'openId'])
		},
		methods: {
			...mapActions('user', ['openModalAction']),
			// 跳转页面
			linkPage(src) {
				if (src == '' || src == undefined) {
					uni.$u.toast('敬请期待')
				} else {
					// 跳转页面
					this.$navTo(src)
				}
			},
			// 点击图片预览
			previewImage(index) {
				const url = this.swiperList[index].image
				uni.previewImage({
					current: url,
					urls: [url]
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	page {
		background: #f8f8f8;
	}

	.content {
		width: 100%;
		height: auto;

		// 容器
		.container {
			position: fixed; // 相对于浏览器
			z-index: 3;
			margin-top: 20rpx;
			width: 100%;
			height: 100%;
			background: #ffffff;
			border-radius: 40rpx 40rpx 0 0;

			// 地图
			.gzist-map {
				float: left;
				width: 100%;
				height: 220px;
				background-color: #f8f8f8;
			}

			.menu-list {
				float: left;
				margin-top: 20rpx;
				margin-left: 40rpx;
				border-top: #f8f8f8 solid 3rpx;
				height: auto;

				.list-item {
					float: left;
					padding: 15rpx 30rpx 15rpx 30rpx;
					width: 115rpx;
					height: 115rpx;

					.item-icon {
						margin-left: 15rpx;
						width: 65rpx;
						height: 65rpx;

						i {
							width: 65rpx;
							height: 65rpx;
						}
					}

					.item-text {
						flex-grow: 1;
						overflow: hidden;
						padding: 5rpx 0 0 0rpx;
						font-size: 20rpx;
						color: #000000;
						letter-spacing: 2rpx;
						text-indent: 3rpx;
					}
				}
			}
		}
	}
</style>